package phoenix.mob_android.page_objects;

import phoenix.core.PhoenixManager;
import phoenix.core.base.extensions.PageBaseMobAndroidExt;
import phoenix.core.config.extensions.ConfigExt;
import phoenix.mob_android.locators.base.FeaturesPageLocatorsBase;

public class FeaturesPage extends PageBaseMobAndroidExt
{
	/**
	 * Initializes the IndexPage
	 * @param p_manager
	 *            PhoenixManager instance
	 */
	public FeaturesPage(PhoenixManager p_manager)
	{
		super(p_manager);
	}

	/**
	 * Gets web elements by site
	 * @return IndexPageLocatorsBase instance
	 */
	public FeaturesPageLocatorsBase elements()
	{
		switch (manager.testModel().getSiteName())
		{
			case ConfigExt.SITE_ID_FLIRT:
			{
				return new phoenix.mob_android.locators.flirt.FeaturesPageLocators();
			}
			case ConfigExt.SITE_ID_WILDBUDDIES:
			{
				return new phoenix.mob_android.locators.wildbuddies.FeaturesPageLocators();
			}
			case ConfigExt.SITE_ID_CHEECKYLOVERS:
			{
				return new phoenix.mob_android.locators.cheeckylovers.FeaturesPageLocators();
			}
			default:
			{
				return null;
			}
		}
	}

	public boolean isOnFeatureSelectionPage()
	{
		md().wait(10);
		return md().isElementPresent(elements().blockFeatureSelectionPage);
	}

	public FeaturesPage selectFeaturePackage()
	{
		log().info("Selecting Full Membership Package");
		md().waitForVisibility(elements().blockFullUpgrade, "Block full upgrade doesn't appear");
		md().click(elements().blockFullUpgrade);

		return this;
	}

	public FeaturesPage submitFeatures()
	{
		md().waitForVisibility(elements().btnSubmitFeatures, "Button submit features doesn't appear");
		md().click(elements().btnSubmitFeatures);

		return this;
	}
}
